# 参考资料：[机器学习进阶-图像基本处理-视频的读取与处理 1.cv2.VideoCapture(视频的载入) 2.vc.isOpened(载入的视频是否可以打开) 3.vc.read(视频中一张图片的读取) 4.cv2.cvtColor(将图片转换为灰度图)](https://www.cnblogs.com/my-love-is-python/p/10390279.html)
import cv2

vc = cv2.VideoCapture('赵雷-成都.avi')

if vc.isOpened():
    # 读取视频中的一张图片
    ret, frame = vc.read()
else:
    ret = False

while ret:
    ret, frame = vc.read()
    if ret == True:
        img = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        cv2.imshow('test', img)
    
    if cv2.waitKey(10) & 0xFF == 27:
        break